home *** CD-ROM | disk | FTP | other *** search
- /*------------------------------------------------------------------------------------------------
- CmDriver Version : 2.0 GM
-
- Copyright © 1994 by Apple Computer, Inc. All rights reserved.
- Copyright © 1994 by Eastman Kodak Company, All rights reserved.
-
- Apple Paul Hangas
- Kodak Takeshi Domen
-
- 8/26/94 Version 2.0 d1 is the first release to Nimbus driver.
- No changes added excpet version of the driver.
- 9/12/94 Version 2.0 d2
- Debugged kCmDecompTableSize value from 98 to 176.
- 9/26/94 Version 2.0 a1c1
- kCmDecompTableSize100 and kCmDecompTableSize150 were added instead of
- kCmDecompTableSize. And these size are below.
- #define kCmDecompTableSize100 98
- #define kCmDecompTableSize150 174
- The previous version supported it 176. But it was not good.
- The correct size of kCmDecompTableSize to Nimbus is 174.
- Also next beacon parameter were added as macro value.
- #define kbeaconParamQT100i 0x0101
- #define kbeaconParamQT100t 0x0100
- #define kbeaconParamQT150 0x0200
- 10/13/94 Version 2.0 a2
- The PictureMode constants were renamed as below:
- kCmColorQ -> kCmLoRes, kCmColor -> kCmHiRes.
- 10/28/94 Version 2.0 b1c1
- To meet changing of GeoPort strategy,the fields of CmPortInfo
- structure were changed from familyID and deviceID to manufacturerID,
- and from beaconParam to productID.
- Also the Manufacturer ID and Product ID were defined as constants.
- #define kCmManufacturerID100 0x0101 -- for Venus
- #define kCmManufacturerID150 0x00c8 -- for Nimbus
-
- #define kProductID100i 0x0101
- #define kProductID100t 0x0100
- #define kProductID150 0x0001
- 11/11/94 Version 2.0 b1c2
- Added error constant, kCmDrvrVersionError when QuickTake™ 100 driver is found
- and QuickTake™ 150 driver is not found.
- 12/ 1/94 Version 2.0 b2
- 12/15/94 Version 2.0 f1c1
- 1/ 9/95 Version 2.0 GM
- ------------------------------------------------------------------------------------------------*/
- #ifndef __CmDriver_h__
- #define __CmDriver_h__
-
- #ifndef __DEVICES__
- #include <Devices.h>
- #endif
-
- /*----------------------- Camera Error Code --------------------------*/
- /* ErrorCategory "error" */
- #define kCmErNoError 0x00
- #define kCmErNoBattery 0x01
- #define kCmErMemoryFull 0x02
- #define kCmErFlashNotReady 0x03
- #define kCmErImageMemoryDefect 0x04
- #define kCmErAttention 0x05
- #define kCmErParityError 0x06
- #define kCmErTimeoutError 0x07
- #define kCmErHardwareError 0x08
- #define kCmErBadParameter 0x09
- #define kCmErBadPictureNumber 0x0A
- #define kCmErUnknownError 0xFF
-
- /*--------------------------------------------------------------------*/
- /* ConstantName "diagnosticsCode" */
- #define kCmErNoError 0x00
- #define kCmErNoBattery 0x01
- #define kCmErMemoryFull 0x02
- #define kCmErFlashNotReady 0x03
- #define kCmErImageMemoryDefect 0x04
- #define kCmErCommandAborted 0x18
- #define kCmErParityError 0x06
- #define kCmErTimeoutError 0x07
- #define kCmErGeneralHWError 0x0B
- #define kCmErCPUError4Bit 0x0C
- #define kCmErCPUError8Bit 0x0D
- #define kCmErDSPError 0x0E
- #define kCmErFrameMemoryError 0x0F
- #define kCmErTooManyImageMemoryDefects 0x19
- #define kCmErImageMemoryError 0x10
- #define kCmErInvalidCmdCode 0x11
- #define kCmErInvalidControlCmd 0x12
- #define kCmErInvalidCmdData 0x13
- #define kCmErInvalidData 0x14
- #define kCmErBadPicNumImage 0x16
- #define kCmErBadPicNumInfo 0x17
-
- /*----------------------------------- Error Code ----------------------------------------------*/
-
- #define kCmCameraError -6200
- #define kCmAIPError kCmCameraError -1
- #define kCmAlreadyOpenError kCmCameraError -2
- #define kCmANIPError kCmCameraError -3
- #define kCmBadArgError kCmCameraError -4
- #define kCmCurrentlyConnectedError kCmCameraError -5
- #define kCmCameraNotFoundError kCmCameraError -6
- #define kCmHandshakeError kCmCameraError -7
- #define kCmNotConnectedError kCmCameraError -8
- #define kCmNoMemoryError kCmCameraError -9
- #define kCmNoSuchPortError kCmCameraError -10
- #define kCmNotOpenError kCmCameraError -11
- #define kCmProtocolError kCmCameraError -12
- #define kCmDriverNotLoadedError kCmCameraError -13
- #define kCmCommError kCmCameraError -14
- #define kCmDrvrVersionError kCmCameraError -15
-
- #define noErr 0
-
- /*----------------------------------------------------------------------------------------------*/
- /* CmSetPictureMode */
- #define kCmHiRes 0x10
- #define kCmLoRes 0x20
-
- /* CmSetFlashMode */
- #define kCmFlashOn 0x02
- #define kCmFlashOff 0x01
- #define kCmFlashAuto 0x00
-
- /* CmSetOwnerName */
- #define kCmOwnerNameLength 32
-
- /*----------------------------------------------------------------------------------------------*/
- #define kCmDecompTableSize100 98
- #define kCmDecompTableSize150 174
-
- /*----------------------------------------------------------------------------------------------*/
- /* Constants for application */
- #define kPowerAdapter 140 // values >= 140 mean a power adapter is connected
-
- // Battery Icon constants for simulating the Battery Icon on the back of the camera
- #define kBatteryIconFull 86 // values >= 86 should show a battery full icon
- #define kBatteryIconHalf 80 // values 80 - 85 should show a battery half icon
- // values below kBatteryIconHalf should show a battery empty icon
- // Battery Icon constants for a more detailed view of hte Battery levels
- #define kBatteryRangeFull 95 // full battery icon
- #define kBatteryRangeEmpty 75 // empty battery icon
- /*----------------------------------------------------------------------------------------------*/
- /* Define QuickTake Manufacturer ID */// Changed 10/24/94 by Domen
- #define kCmManufacturerID100 0x0101
- #define kCmManufacturerID150 0x00c8
-
- /*----------------------------------------------------------------------------------------------*/
- /* Define QuickTake Manufacturer ID */// Changed 10/24/94 by Domen
- #define kProductID100i 0x0101
- #define kProductID100t 0x0100
- #define kProductID150 0x0001
- //--------------------------------------------------------------------------------------------------
-
- typedef struct {
- long currentA5;
- ParamBlockRec paramBlock;
- Boolean connectedFlag;
- } CmCameraData;
-
- /*----------------------------------------------------------------------------------------------*/
-
- typedef CmCameraData* CameraData;
- typedef CameraData* CameraDataPtr;
- typedef unsigned char* BufferPtr;
- typedef unsigned long* LongPtr;
- typedef short* shortPtr;
-
- /*----------------------------------------------------------------------------------------------*/
-
- typedef struct {
- short version;
- } CmStdFeatures, *CmStdFeaturesPtr;
-
- typedef struct {
- Handle portIcon;
- StringHandle portName;
- unsigned long portStatus;
- StringHandle appName;
- unsigned short manufacturerID; // Changed 10/24/94 by Domen
- unsigned short productID; // Changed 10/24/94 by Domen
- Handle portConfig;
- unsigned long DataSpeed;
- } CmPortInfo, *CmPortInfoPtr, **CmPortInfoHandle;
-
- typedef CmPortInfoHandle* CmPortInfoHandlePtr;
-
- /*----------------------------------------------------------------------------------------------*/
-
- typedef struct {
- char vendorName[8]; /* Apple Computer */
- char productIdentification[16]; /* Apple Digital Camera */
- unsigned char hardwareVersion[2]; /* 1.01 - byte[1]=01, byte[0]=01 */
- unsigned char firmwareVersion[2]; /* 1.10 - byte[1]=01, byte[0]=10 */
- } CmProductInfo, *CmProductInfoPtr;
-
-
- typedef struct {
- unsigned char month;
- unsigned char day;
- unsigned char year;
- unsigned char hour;
- unsigned char minute;
- unsigned char second;
- } CmDateAndTime, *CmDateAndTimePtr;
-
-
- typedef struct {
- unsigned char transferRate;
- unsigned char configuration; /* HostMode */
- unsigned char timeOut;
- } CmInterface;
-
-
- typedef struct {
- unsigned char batteryStatus;
- unsigned short noPicturesTaken;
- unsigned short noPictureImageAvailable;
- unsigned short fullImageWidth;
- unsigned short fullImageHeight;
- unsigned short thumbnailImageWidth;
- unsigned short thumbnailImageHeight;
- CmDateAndTime cameraDateAndTime;
- unsigned char flashMode;
- unsigned short exposureTime;
- unsigned short FNumber;
- unsigned char pictureMode; /* bit0=0 Full Size, bit0=1 1/4 size, bit4=0 B&W, bit4=1 Color */
- unsigned char reserved;
- unsigned char fullImageDatCompMode;
- unsigned char thumbImageDatCompMode;
- unsigned long totalMemorySize;
- unsigned long freeMemorySize;
- char ownerName[32]; /* CameraID */
- unsigned char CCDSensorType;
- CmInterface hostInterface;
- unsigned char cameraInformationBytes[6];
- unsigned char compDecompParamVersion[4];
- unsigned char colorMatrixVersion[4];
- unsigned char spareImageMemoryBlock;
- unsigned short noBasePicturesTaken;
- unsigned short noQuarterPicturesTaken;
- unsigned char sleepDelay;
- } CmCameraInfo, *CmCameraInfoPtr;
-
- //typedef CmCameraInfo*;
-
- typedef struct {
- unsigned short pictureNo;
- unsigned long imageDataSize;
- unsigned short width;
- unsigned short height;
- CmDateAndTime dateAndTime;
- unsigned char flashMode;
- unsigned short exposureTime;
- unsigned short FNumber;
- unsigned char pictureMode; /* bit0=0 Full Size, bit0=1 1/4 size, bit4=0 B&W, bit4=1 Color */
- unsigned char dataCompressionMode; /* CFA=0, ADPCM=1, ColorDiff=2 */
- unsigned char defectiveFlag;
- } CmPictureInfo, *CmPictureInfoPtr;
-
- typedef struct {
- unsigned char colorMatrixVersion[4];
- double colorCorrectionMatrix[12];
- } CmColorMatrix, *CmColorMatrixPtr;
-
- /*----------------------------------------------------------------------------------------------*/
- typedef void (CallbackProc) ();
- /* This is the completion routine definition. This is called from
- the driver when an async function is called.
- /*----------------------------------------------------------------------------------------------*/
- typedef CallbackProc* CmAsyncCompletionRoutinePtr;
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmOpenDriver(CameraData* cameraData);
- /* Open the Camera Driver. Driver memory is allocated and High
- Speed Serial code is loaded. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmCloseDriver(CameraData cameraData);
- /* Close the Camera Driver. Driver memory is disposed and High
- Speed Serial code is disposed. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmGetStdFeatures(CameraData cameraData,
- CmStdFeaturesPtr stdFeaturesPtr,
- short length);
- /* Get the standard features of the camera driver. The
- 'CmStdFeatures' record will be filled up to the 'length'. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmGetPortInfo(CameraData cameraData,
- unsigned long index,
- CmPortInfoHandlePtr portInfoHandle);
- /* Get information about the port specified by 'index' and return
- a Handle to the 'CmPortInfo' info. If there is no port for that
- 'index' the Handle will be NULL. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmDisposePortInfo(CameraData cameraData,
- CmPortInfoHandle portInfoHandle);
- /* Dispose the CmPortInfo record and the Handles contained within
- it. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmConnect(CameraData cameraData,
- CmPortInfoHandle portInfoHandle);
- /* Connect to the camera on the port specified by the CmPortInfo. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmDisconnect(CameraData cameraData);
- /* Disconnect from the camera. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmCheckIfReady(CameraData cameraData);
- /* Check to see if the camera is ready for commands. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmRestoreDefaults(CameraData cameraData);
- /* Restore the camera to the default settings. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmGetErrorInfo(CameraData cameraData,
- shortPtr category,
- shortPtr detail);
- /* Get camera hardware specific detailed error information. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmGetProductInfo(CameraData cameraData,
- CmProductInfoPtr productInfo);
- /* Get camera hardware product information. This includes the
- vendor name, product name, and version */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmTakePicture(CameraData cameraData,
- Boolean timerOn);
- /* Take a picture. The camera will take the picture in Timer Mode
- if 'timerOn' is true. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmTakePictureAsync(CameraData cameraData,
- Boolean timerOn,
- CmAsyncCompletionRoutinePtr CmAsyncCompletionRoutine);
- /* Take a picture. The camera will take the picture in Timer Mode
- if 'timerOn' is true.
- The 'completionRoutine' is a pointer to a routine
- that is called from the driver when the driver completes. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmSelfTest(CameraData cameraData);
- /* Camera will perform a diagnostic self test. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmGetCameraInfo(CameraData cameraData,
- CmCameraInfoPtr cameraInfo);
- /* Get the camera information. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmGetPictureInfo(CameraData cameraData,
- unsigned short pictureNo,
- CmPictureInfoPtr pictureInfo);
- /* Get the picture information for the 'pictureNo' image. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmGetThumbnailImage(CameraData cameraData,
- unsigned short pictureNo,
- BufferPtr thumbnailBuffer,
- unsigned long numberOfBytesToRead,
- Boolean firstRead,
- LongPtr actualBytes);
- /* Get the thumbnail image specified by 'pictureNo'.
- To read the entire image in a single call, set
- 'numberOfBytesToRead' = the image size, 'firstRead' = true,
- and 'thumbnailBuffer' = pointer to a buffer; then call
- 'CmGetThumbnailImage'.
- To read the entire image with multiple calls, set
- 'numberOfBytesToRead' = the first number of bytes to read
- (this has to be a multiple of 512),
- 'firstRead' = true, and 'thumbnailBuffer' = pointer to a buffer;
- then call 'CmGetThumbnailImage'. The remaining data may be read
- by calling 'CmGetThumbnailImage' multiple times with 'firstRead'
- = false, 'numberOfBytesToRead' = the next number of bytes to read,
- and 'thumbnailBuffer' = pointer into the new location in the
- buffer.
- The 'actualBytes' contains the number of bytes actually read. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmGetFullSizeImage(CameraData cameraData,
- unsigned short pictureNo,
- BufferPtr imageBuffer,
- unsigned long numberOfBytesToRead,
- Boolean firstRead,
- LongPtr actualBytes);
- /* Get the full size image specified by 'pictureNo'.
- To read the entire image in a single call, set
- 'numberOfBytesToRead' = the image size, 'firstRead' = true,
- and 'imageBuffer' = pointer to a buffer; then call
- 'CmGetFullSizeImage'.
- To read the entire image with multiple calls, set
- 'numberOfBytesToRead' = the first number of bytes to read
- (this has to be a multiple of 512),
- 'firstRead' = true, and 'imageBuffer' = pointer to a buffer;
- then call 'CmGetFullSizeImage'. The remaining data may be read
- by calling 'CmGetFullSizeImage' multiple times with 'firstRead'
- = false, 'numberOfBytesToRead' = the next number of bytes to read,
- and 'imageBuffer' = pointer into the new location in the
- buffer.
- The 'actualBytes' contains the number of bytes actually read. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmErase(CameraData cameraData);
- /* Erase the images from the camera's memory. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmEraseAsync(CameraData cameraData,
- CmAsyncCompletionRoutinePtr CmAsyncCompletionRoutine);
- /* Erase the images from the camera's memory.
- The 'completionRoutine' is a pointer to a routine
- that is called from the driver when the driver completes. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmSetDateAndTime(CameraData cameraData,
- CmDateAndTimePtr dateAndTime);
- /* Set the camera's date and time. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmSetOwnerName(CameraData cameraData,
- BufferPtr ownerName);
- /* Set the camera's owner name. This is a 32 character string. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmSetPictureMode(CameraData cameraData,
- unsigned char pictureMode);
- /* Set the 'pictureMode' of the camera. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmSetFlashMode(CameraData cameraData,
- unsigned char flashOn);
- /* Set the flash mode on or off. */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmGetDecompTable(CameraData cameraData,
- BufferPtr ipmInfo);
- /* Get the data compression/decompression table */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmGetColorCorrectionMatrix(CameraData cameraData,
- CmColorMatrixPtr colorMatrix);
- /* Get the camera color correction matrix */
- /*----------------------------------------------------------------------------------------------*/
- pascal OSErr CmSetSleep(CameraData cameraData,
- short sleepDelay);
- /* Set the sleep delay (while connected to a computer) of the camera */
- /*----------------------------------------------------------------------------------------------*/
-
- #endif
-